﻿//获取url中的参数
function getUrlParam(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
	var r = window.location.search.substr(1).match(reg); //匹配目标参数
	if(r != null) return unescape(r[2]);
	return null; //返回参数值
}

//设置请求
function GetUrl(){
	//var url="http://192.168.1.27:8080";
	//
	var url ="http://web.mychinavvv.com";
	return url
}
//重写url
function url(url)
{
	//return "http://yhzj.ebenbank.com:8090/"+url;
    return "http://127.0.0.1:8090/"+url;
}

//初始化加载
function Startload() {
	layer.open({
		type: 2,
		time: 3
	})
	//$.dialog.tips('数据加载中...', 600, 'loading.gif');

}

//提示信息
function msg(content, btn1, btn2, yesBtn, noBtn) {
	layer.open({
		shadeClose: false,
		content: content,
		style: 'background:rgba(0,0,0,0.6);color:white;width:30%; height:250px;font-size:26px; line-height:50px; margin-top:150px;',
		btn: [btn1, btn2],
		yes: function() {
			layer.open({
				content: yesBtn,
				time: 1,
				style: 'background:rgba(0,0,0,0.6);color:white;width:30%; height:250px;font-size:30px; line-height:50px;'
			});
		},
		no: function() {
			layer.open({
				content: noBtn,
				time: 1,
				style: 'background:rgba(0,0,0,0.6);color:white;width:30%; height:250px;font-size:30px; line-height:50px;'
			});
		}
	});
}

//提示信息
function msgError(content) {
	layer.open({
		shade: 0,
		type: 3,
		content: content,
		time: 1,
		style: 'background:rgba(0,0,0,0.6);color:white;width:40%; height:60px;font-size:14px; line-height:5px;'
	})
	return true;
}

//设置cookie
function setCookie(name, value,path) {
	var Days = 1;
	var exp = new Date();
	exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
	document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString()+";path=/";
}

//读取cookie
function getCookie(name) {
	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
	if(arr = document.cookie.match(reg))
		return unescape(arr[2]);
	else
		return null;
}

//删除cookie
function delCookie(name) {
	var exp = new Date();
	exp.setTime(exp.getTime() - 1);
	var cval = getCookie(name);
	if(cval != null)
		document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}

//验证手机号是否合法
function Verifyphone(phone) {

	if(!(/^1[3|4|5|6|7|8]\d{9}$/.test(phone))) {
		msgError("手机号码有误，请重填");
		return false;
	}
	else
	{
		return true;
	}

}

//判断验证码是否一致
function checkCode(code)
{
	//调用短信接口
	return code;
}

//判断两个字符串是否相等
function strEqual(obj1,obj2)
{
	if(obj1===obj2)
	{
		return true;
	}
	else
	{
		return false;
	}
}
//解析url
function GetRequest() {
	var url = location.search; //获取url中"?"符后的字串
	var theRequest = new Object();
	if(url.indexOf("?") != -1) {
		var str = url.substr(1);
		strs = str.split("&");
		for(var i = 0; i < strs.length; i++) {
			theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1];
		}
	}
	return theRequest;
}